package com.huazai.study;

import javax.servlet.annotation.WebServlet;

public class ReflectAnnotation {
    public static void main(String[] args) throws ClassNotFoundException {
        Class<?> WebServletAnnotation = Class.forName("com.huazai.ServletStudy.ServletDemo01");

        if ( WebServletAnnotation.isAnnotationPresent(WebServlet.class) ) {
            WebServlet annotation = WebServletAnnotation.getAnnotation(WebServlet.class);
            System.out.println("annotation.name() = " + annotation.name());

            String[] values = annotation.value();

            for (int i = 0; i < values.length; i++) {
                System.out.println("values["+ i +"] = " + values[i]);
            }
        }
    }
}
